//青蛙类
//1.生成青蛙
//2.更换青蛙的皮肤和动画
//3.更新青蛙的动画，朝向和移动位置
enum daojv { "", "隐身", "减速", "剪刀", "喝酒", "变色", "固定加分荷叶", "死亡加分荷叶", "眩晕" };
enum daojveff { "", "隐身", "ice", "jiandao", "drink", "bianse", "固定加分荷叶", "死亡加分荷叶", "xuanyun" };
enum ClipName { "ice", "jiandao", "drink", "bianse", "heart", "paopao", "xuanyun", "miwu", "xinsui", "levelUp" };
module control {
	export class frog extends eui.Component {
		public constructor(Game: any) {
			super();
			this.gamePanleHandle = Game.displayContainer;
			this.m_frogMgr = Game;
		}
		/**断线惩罚 */
		public ispunish = false;
		/**是有颜色 */
		public iscolour = true;
		/**表情持续时间 */
		public eyetime = -1;
		/**墨镜持续时间 */
		public eyetimeMojing = -1;
		/**青蛙眼睛 */
		public qineyer: number = 1;
		/**青蛙大小 */
		public size;
		/**判断玩家升级所需的值 */
		protected frogUpdatePeroidValue = 100;
		/**游戏界面的句柄 */
		protected gamePanleHandle;

		/**青蛙管理句柄 */
		protected m_frogMgr;
		/**阴影 */
		public shadow: eui.Image;
		/**配置文件 */
		public c = serverConfig.config;
		/**保存玩家的id */
		public userid;

		/**保存玩家的名字 */
		public username;

		/**玩家的类型 */
		public type;
		/**等级 */
		public level: number;
		/**舌宽 */
		public tongueWide: number;
		/**分数 */
		public grade: number;
		/**判断青蛙是否存活，或者是否被使用 */
		public isUsed;

		/**判断青蛙在队列中的位置*/
		public frogId;

		/**玩家动画显示对象   可用此对象控制玩家动画 */
		public frogAniamtionDis;

		/**青蛙拖尾 */
		public frogTrai;

		/**青蛙名字 用于显示 */
		public frogName: eui.Label;

		/**玩家是否已连线 */
		public frogIsHadLine: boolean;

		public deathDate: any;

		public roomID: any;
		/**青蛙舌长 */
		public frogLineLength = 0;

		/**线快断掉了 */
		protected tu: eui.Image = new eui.Image();
		/**护盾外 */
		protected shieldOuter: eui.Image = new eui.Image();
		/**护盾内 */
		protected shieldInside: eui.Image = new eui.Image();
		/**玩家装饰 */
		protected shipin: eui.Image = new eui.Image();
		protected shipin_1: eui.Image = new eui.Image();
		protected shipin_2: eui.Image = new eui.Image();
		protected shipin_3: eui.Image = new eui.Image();
		protected shipin_4: eui.Image = new eui.Image();
		protected shipin_5: eui.Image = new eui.Image();
		protected shipin1: eui.Image = new eui.Image();
		/**粒子层 */
		protected tralingLayer: egret.Sprite = new egret.Sprite();
		/**道具效果 */
		public effectOfProps: eui.Image = new eui.Image();
		/**连杀数 */
		protected killNum = 0;
		/**曲线终点位置 */
		public pointOver: egret.Point;
		/**动画播放状态 */
		public tweenOver: boolean;
		/**帧动画层 */
		protected ClipLayer: egret.Sprite = new egret.Sprite();
		/**青蛙身上出现冰块图片*/
		protected ice2: eui.Image = new eui.Image();
		/** 舔到异色青蛙眼睛两边变化-头上的黑线*/
		protected heixian: eui.Image = new eui.Image();
		/** 舔到异色青蛙眼睛两边变化-头顶的汗*/
		protected han: eui.Image = new eui.Image();
		/** 舔到异色青蛙眼睛内变化*/
		protected eyeLeft: eui.Image = new eui.Image();
		/** 舔到异色青蛙眼睛内变化-右眼*/
		protected eyeRight: eui.Image = new eui.Image();
		/** 舔到异色青蛙眼睛内变化-tween动画的变化*/
		protected eyeLR: eui.Image = new eui.Image();
		/**显示道具效果-状态图片 */
		protected zhuangtai_1: eui.Image = new eui.Image();
		/**添加碰撞是左右两侧的波纹(bowen)-右侧 */
		protected bwRight: egret.Bitmap = new egret.Bitmap();
		/**添加碰撞是左右两侧的波纹(bowen) -左侧*/
		protected bwLeft: egret.Bitmap = new egret.Bitmap();
		/**判断青蛙的速度*/
		public distanceMax = 1;
		public targetPost: egret.Point;
		protected myPos: egret.Point;
		protected isborn = false;
		public speed: number = 5;
		public targetDir: egret.Point;
		public targetPoint: egret.Point;
		public curPoint: egret.Point;
		/**舌头对象 */
		public tongue: eui.Image;
		/**是否在视野范围内， */
		protected isInRange: boolean;
		/**左眼 */
		protected leftEye: egret.Bitmap;
		/**右眼 */
		protected rightEye: egret.Bitmap;


		/**当前道具效果  防止一直加载 */
		public nowPropsType = [-1, -1, -1, -1, -1, -1, -1, -1, -1];
		public init(index) {
			this.type = 0;
			this.level = 11;
			this.anchorOffsetX = this.width / 2;
			this.anchorOffsetY = this.height / 2;
			this.size = serverConfig.config.size;
			this.targetDir = egret.Point.create(0, 0);
			this.targetPoint = egret.Point.create(0, 0);
			this.curPoint = egret.Point.create(0, 0);
			this.loadRes();
			this.gamePanleHandle.addChild(this.tralingLayer);
			this.tongueInit();

			this.frogAniamtionDis = meterAanimation.getInstance().GetDragonAnimation(1);
			this.addChild(this.frogAniamtionDis);
			this.setChildIndex(this.frogAniamtionDis, 0);
			FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
			this.shipinInit();
			this.jisha();
			this.displayShield();
			this.tweenOver = true;
			this.frogLineLength = AIPropsMgr.getInstance().GetAttributesByGrade(0).frogLineLength;
			this.tongueWide = AIPropsMgr.getInstance().GetAttributesByGrade(0).tongueWide;
			this.isUsed = false;
			this.userid = -1;
			this.frogId = index;
			this.visible = false;
			this.gamePanleHandle.addChild(this);
			this.gamePanleHandle.addChild(this.ClipLayer);//添加帧动画层
			this.displayFrogName();
			this.displayEffectOfProps(this.nowPropsType);
			this.targetPost = new egret.Point(0, 0);
			this.myPos = new egret.Point(0, 0);
			this.pointOver = new egret.Point(0, 0);
			this.addClip();
			this.isInRange = true;
			this.all_Image();
			this.EyesInit();


		}
		/**眼睛初始化 */
		protected EyesInit() {
			this.leftEye = new egret.Bitmap();
			this.rightEye = new egret.Bitmap();
			FaceManager.GetInstance().ChangeNormalEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
		}
		/**减少内存泄漏，初始化所有图片 */
		protected all_Image() {
			this.ice2.texture = resManager.getInstance().getExpressionGroups(0);
			this.heixian.texture = resManager.getInstance().getExpressionGroups(1);
			this.heixian.anchorOffsetX = this.heixian.width / 2;
			this.heixian.anchorOffsetY = this.heixian.height / 2;

			this.han.texture = resManager.getInstance().getExpressionGroups(2);
			this.han.anchorOffsetX = this.han.width / 2;
			this.han.anchorOffsetY = this.han.height / 2;

			this.eyeLeft.texture = resManager.getInstance().getExpressionGroups(3);
			this.eyeLeft.anchorOffsetX = this.eyeLeft.width / 2;
			this.eyeLeft.anchorOffsetY = this.eyeLeft.height / 2;

			this.eyeRight.texture = resManager.getInstance().getExpressionGroups(3);
			this.eyeRight.anchorOffsetX = this.eyeRight.width / 2;
			this.eyeRight.anchorOffsetY = this.eyeRight.height / 2;

			this.eyeLR.texture = resManager.getInstance().getExpressionGroups(4);

			this.zhuangtai_1.texture = resManager.getInstance().getExpressionGroups(5);

			this.bwRight.texture = resManager.getInstance().getExpressionGroups(6);
			//console.log(resManager.getInstance().getExpressionGroups(0));
			this.bwRight.anchorOffsetY = this.bwRight.height / 2;
			this.bwRight.anchorOffsetX = this.bwRight.width / 2;

			this.bwLeft.texture = resManager.getInstance().getExpressionGroups(6);
			this.bwLeft.anchorOffsetY = this.bwLeft.height / 2;
			this.bwLeft.anchorOffsetX = this.bwLeft.width / 2;

			this.shipin_1.texture = resManager.getInstance().getExpressionGroups(7);
			this.shipin_2.texture = resManager.getInstance().getExpressionGroups(8);
			this.shipin_3.texture = resManager.getInstance().getExpressionGroups(9);
			this.shipin_4.texture = resManager.getInstance().getExpressionGroups(10);
			this.shipin_5.texture = resManager.getInstance().getExpressionGroups(11);

			this.tu.texture = resManager.getInstance().getExpressionGroups(12);

		}

		public setInRange(isRange) {
			this.isInRange = isRange;
		}
		/**舌头初始化 */
		public tongueInit() {
			let tongue: eui.Image = new eui.Image;
			tongue.texture = resManager.getInstance().getExpressionGroups(13);
			tongue.anchorOffsetY = tongue.height / 2;
			tongue.width = 0;
			tongue.rotation = - 90;
			tongue.visible = false;
			tongue.y = -40;
			this.tongue = tongue;
			this.addChild(this.tongue);
		}
		/**初始化阴影 */
		public shadowinint() {
			this.shadow = new eui.Image();
			this.shadow.scaleX = this.shadow.scaleY = 1.5;
			this.shadow.anchorOffsetX = this.width / 2;
			this.shadow.anchorOffsetY = this.height / 2;
			this.shadow.x = 0
			this.shadow.y = -30
			this.shadow.texture = resManager.getInstance().getExpressionGroups(14);
			this.shadow.alpha = 0.8
			//this.shadow.visible=false;
			this.shadow.visible = true;
		}
		/**根据体型设置阴影大小 */
		public setShadow() {
			if (Math.floor(this.level / 10) == 1) {
				this.shadow.scaleX = this.shadow.scaleY = 1.5;
				this.shadow.anchorOffsetX = this.width / 2;
				this.shadow.anchorOffsetY = this.height / 2;
				this.shadow.x = 0
				this.shadow.y = -30
			}
			if (Math.floor(this.level / 10) == 2) {
				this.shadow.scaleX = this.shadow.scaleY = 1.6;
				this.shadow.anchorOffsetX = this.width / 2;
				this.shadow.anchorOffsetY = this.height / 2;
				this.shadow.x = 5
				this.shadow.y = -25
			}
			if (Math.floor(this.level / 10) == 3) {
				this.shadow.scaleX = this.shadow.scaleY = 2.2;
				this.shadow.anchorOffsetX = this.width / 2;
				this.shadow.anchorOffsetY = this.height / 2;
				this.shadow.x = 5
				this.shadow.y = -25
			}
			if (Math.floor(this.level / 10) == 4) {
				this.shadow.scaleX = this.shadow.scaleY = 2.3;
				this.shadow.anchorOffsetX = this.width / 2;
				this.shadow.anchorOffsetY = this.height / 2;
				this.shadow.x = 5
				this.shadow.y = -25
			}
		}
		/**检查视野范围内的方法 */
		protected checkInRange() {
			//如果是新手教程，就return
			if (DataProl.isXinShou) {
				return;
			}
			//判断是否在视野范围内，是就显示青蛙名字（节省内存）
			this.frogName.visible = this.isInRange;
			//道具效果同理
			this.effectOfProps.visible = this.isInRange;
			this.visible = this.isInRange;

			// }
		}

		/**玩家数据更新 */
		public dataUpdata(e: any) {
			if (e.states != 1) {
				this.deathDate = e.death.isDeath;
				if (e.death.isDeath) {
					this.frogDied();
					this.killNum = 0;
					return;
				}

				this.checkInRange();
				//this.GetAttributesByGrade(e.lineLength);
				//玩家数据从数据类拿
				this.grade = e.grade;
				this.tongueWide = e.tongueWide;
				this.frogLineLength = e.lineLength;
				this.setTargetPoint(e);
				this.displayOrHideShield(e.NewHandProtect.isProtect);
				this.displayEffectOfProps(e.propStates);
				if (e.propStates[2].getPropType != 3) {//道具剪刀状态，只剪一次线，剪后小剪刀消失
					if (this.Clip_shuzu[1].visible == true) {
						this.Clip_shuzu[1].visible = false;
					}
				}
				/**判断玩家是否隐身 */
				if (e.propStates[0].getPropType == 1) {
					//吃到隐身，更改alpha值
					this.frogName.alpha = 0.1;
					this.effectOfProps.alpha = 0.1;
					this.alpha = 0.1;
				}
				else {
					this.frogName.alpha = 1;
					this.alpha = 1;
					this.effectOfProps.alpha = 0;
				}
				if (this.isInRange == true) {
					//如果数组下表是3，那么就是道具喝酒的时间
					if (this.nowPropsType[3] == daojv["喝酒"]) {
						//如果眼睛不为4更改眼睛为4
						if (this.qineyer != 4) {
							//this.changeClothes.changeClotheseye(this.frogAniamtionDis, 4);
							//调取眩晕眼睛的方法，传进去显示动画、左眼和右眼
							FaceManager.GetInstance().ChangeDizzinessEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
							//把眼睛改成4
							this.qineyer = 4;
							console.log(this.leftEye.texture);

						}
					}
					else if (this.nowPropsType[7] == daojveff["xuanyun"]) {
						if (this.qineyer != 4) {
							//眩晕同理
							FaceManager.GetInstance().ChangeDizzinessEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
							this.qineyer = 4;

						}
					}
					else {
						//如果青蛙眼睛为4
						if (this.qineyer == 4) {
							//声明一个A来判断青蛙眼睛要改变成什么样，默认为1
							var a = 1;
							//改成正常眼
							FaceManager.GetInstance().ChangeNormalEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
							//如果是短线惩罚
							if (this.ispunish) {
								a = 3;
								//改成断线眼
								FaceManager.GetInstance().ChangeCryEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
							}
							//把A的值赋值给青蛙眼睛
							this.qineyer = a;
						}
					}
				}
				/*if (this.nowPropsType == 6||this.nowPropsType == 7)
				 {
                        this.nowPropsType=-1;
				}*/
				/**判断玩家表情结束 */
				if (this.eyetime != -1 && this.qineyer != 4 && this.qineyer != 3) {

					if (Date.now() - this.eyetime > 500) {
						FaceManager.GetInstance().ChangeNormalEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
						this.eyetime = -1;
						this.qineyer = 1;
					}
				}
				/**判断玩家击杀（墨镜）表情结束 */
				if (this.eyetimeMojing != -1) {
					if (Date.now() - this.eyetimeMojing > 1000) {
						this.shipin1.visible = false;
						this.eyetimeMojing = -1;
					}
				}
				/**断线处罚 */
				if (!this.ispunish && e.disconnection_line) {
					this.ispunish = true;
					this.changeFaceEye(3, null);//00修改快断线					

				}
				if (this.ispunish && !e.disconnection_line) {
					this.ispunish = false;
					if (this.isInRange == true) {
						FaceManager.GetInstance().ChangeNormalEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);

						this.qineyer = 1;
					}

					FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);

					//	 console.log("frog name"+e.name+"处罚结束")
				}
				this.frogIsHadLine = e.ishadLine;
				this.DetermineKill(e.killNumber);


				this.dealFrogUpgrade(e);
				if (this.isInRange == true) {
					//道具五。。变色
					if (webNetworkMananger.getInstance().gameSceneRec.myUser.userSprit.nowPropsType[4] == daojv["变色"]) {
					}
					if (this.type != e.frogType) {
						this.type = e.frogType;
						if (!this.ispunish) {
							this.changeType();
							this.nowPropsType[4] = -1;
							AIUserMgr.getInstance().resetPlayerOnePropStates(e, 4);
						}
					}
				}
				/**防止两个黄色 */
				if (this.userid != DataProl.account && this.frogName.textColor != 0xffffff)
					this.frogName.textColor = 0xffffff;
				this.setFrogPos();
			}
			if (DataProl.isXinShou && !e.isAI) {
				if (webNetworkMananger.getInstance().gameSceneRec.prop_messageTimes == 12) {
					if (e.x >= GlobalData.GameStage_width * DataProl.gameSceneScal / 3 * 2 + 80) {
						webNetworkMananger.getInstance().gameSceneRec.set_player_Point(GlobalData.GameStage_width * DataProl.gameSceneScal / 2 + 100, GlobalData.GameStage_height * DataProl.gameSceneScal / 2 + 100);
						webNetworkMananger.getInstance().gameSceneRec.displayer_message(11, 700, 500);
						AIServer.getInstance().deleteLineFrog(3, null);
					}
				}

			}

		}
		/**判断击杀 */
		protected DetermineKill(killNumber) {
			//击杀
			if (this.killNum < killNumber) {
				//预留判断击杀眼镜
				if (!this.shipin1.visible) {
					this.shipin1.visible = true;
					this.eyetimeMojing = Date.now();
				}
				//显示击杀特效
				if (this.userid == DataProl.account) {
					if (this.isInRange == true) {
						webNetworkMananger.getInstance().gameSceneRec.disPlayKillMan(killNumber);
					}
				}
			}
			this.killNum = killNumber;
		}
		/**帧动画数组 */
		protected Clip_shuzu = new Array();
		/**添加帧动画到数组 */
		protected addClip() {

			for (var i = 0; i < 10; i++) {
				var data = RES.getRes(ClipName[i] + "_json");
				var txtr = RES.getRes(ClipName[i] + "_png");
				var MovieClipFactory = new egret.MovieClipDataFactory(data, txtr);
				var Clip = new egret.MovieClip(MovieClipFactory.generateMovieClipData(ClipName[i]));
				Clip.name = ClipName[i];
				Clip.anchorOffsetX = Clip.width / 2;
				Clip.anchorOffsetY = Clip.height / 2;
				Clip.scaleX = 0.5;
				Clip.scaleY = 0.5;
				this.Clip_shuzu.push(Clip);
			}
			this.Clip_shuzu[9].addEventListener(egret.Event.COMPLETE, function (e: egret.Event): void {
				this.Clip_shuzu[9].visible = false;
			}, this);
		}
		/**眩晕次数 */
		protected xuanyunTime = 0;
		/**变色次数 */
		protected bianseTime = 0;
		/**迷雾次数 */
		protected miwuTime = 0;
		/**心碎次数 */
		protected xinsuiTime = 0;
		/**升级次数 */
		protected lvupnum = 0;
		/**播放帧动画 */
		protected MovieClipPlay(type: number) {


			this.Clip_shuzu[type].visible = true;

			if (!DataProl.isXinShou) {
				if (!this.isInRange)
					return;
			}
			if (this.isInRange == true) {
				if (this.Clip_shuzu[type].name == "xuanyun") {
					//设置眩晕时旋转的星星在青蛙头顶
					this.Clip_shuzu[type].anchorOffsetX = this.shipin1.width / 2;
					this.Clip_shuzu[type].anchorOffsetY = this.shipin1.height / 2;
					this.Clip_shuzu[type].x = -3;
					this.Clip_shuzu[type].y = -50;
					this.addChild(this.Clip_shuzu[type]);
					if (this.xuanyunTime == 0) {
						this.xuanyunTime = 1;
						if (DataProl.isXinShou) {//在第一次碰撞时出现碰撞提示面板
							webNetworkMananger.getInstance().gameSceneRec.displayer_message(12, 700, 500);
						}
						this.Clip_shuzu[type].play(1);
					} else {
						this.Clip_shuzu[type].play(2);
					}
					this.Clip_CallBack(type, 1000);
					return;
				}
				if (this.Clip_shuzu[type].name == "drink") {
					this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 0.8;
					this.Clip_shuzu[type].anchorOffsetX = this.shipin1.width / 2;
					this.Clip_shuzu[type].anchorOffsetY = this.shipin1.height / 2;
					this.Clip_shuzu[type].x = 10;
					this.Clip_shuzu[type].y = -100;
					this.addChild(this.Clip_shuzu[type]);
					if (this.isInRange == true) {
						FaceManager.GetInstance().ChangeDizzinessEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
					}
					this.Clip_shuzu[type].play(serverConfig.config.propBuffReationTime.drink / 1000 + 5);
					this.Clip_CallBack(type, 1000);
					return;
				}
				if (this.Clip_shuzu[type].name == "paopao") {
					this.addChild(this.Clip_shuzu[type]);
					//设定眩晕时副帧动画（第二个帧动画）的冒泡的位置从青蛙头顶开始
					this.Clip_shuzu[type].x = -100;
					this.Clip_shuzu[type].y = -150;
					this.Clip_shuzu[type].play(serverConfig.config.propBuffReationTime.drink / 1000);
					this.Clip_CallBack(type, 1000);
					return;
				}
				if (this.Clip_shuzu[type].name == "bianse") {
					this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 1;
					this.ClipLayer.addChild(this.Clip_shuzu[type]);
					if (this.bianseTime == 0) {
						this.setClip(type, -45, -160, 1);
						this.bianseTime = 1;
					} else {
						this.setClip(type, -45, -160, 2);
					}
					this.Clip_CallBack(type, 1000);
					//this.Clip_CallBack(type);
					return;
				}
				if (this.Clip_shuzu[type].name == "levelUp") {

					//删除青蛙tween动画
					egret.Tween.removeTweens(this.Clip_shuzu[type]);
					//缩放大小都为1
					this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 1;
					//把帧动画层添加进
					this.ClipLayer.addChild(this.Clip_shuzu[type]);
					//X,Y相同
					this.Clip_shuzu[type].scaleX = this.scaleX;
					this.Clip_shuzu[type].scaleY = this.scaleY;
					///**固定动画播放位置在名字正上方，且方向固定 */		
					if (this.lvupnum == 0) {
						this.setClip(type, -100, -100, 1)
						this.lvupnum = 1;
						this.Clip_shuzu[type].play(1);
					} else {
						this.setClip(type, -100, -100, 2)
					}
				}
				if (this.Clip_shuzu[type].name == "ice") {
					this.ClipLayer.addChild(this.Clip_shuzu[type]);
					this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 0.8;
					this.setClip(type, 10, -140, serverConfig.config.propBuffReationTime.ice / 1000);
					this.ice_Play();
					this.Clip_CallBack(type, serverConfig.config.propBuffReationTime.ice);
					return;
				}
				if (this.Clip_shuzu[type].name == "jiandao") {
					this.ClipLayer.addChild(this.Clip_shuzu[type]);
					this.setClip(type, 10, -125, serverConfig.config.propBuffReationTime.cut / 1000);
					this.Clip_CallBack(type, serverConfig.config.propBuffReationTime.cut);
					return;
				}
				if (this.Clip_shuzu[type].name == "heart") {
					this.ClipLayer.addChild(this.Clip_shuzu[type]);
					this.setClip(type, 0, -85, 2);
					if (DataProl.isXinShou && webNetworkMananger.getInstance().gameSceneRec.prop_messageTimes == 10) {//新手引导玩家第一次连线
						webNetworkMananger.getInstance().gameSceneRec.displayer_message(10, 900, 500);
						webNetworkMananger.getInstance().gameSceneRec.lock_shoot();
					} else if (DataProl.isXinShou && webNetworkMananger.getInstance().gameSceneRec.prop_messageTimes == 12) {//新手引导第二次连线
						webNetworkMananger.getInstance().gameSceneRec.lock_shoot();
						webNetworkMananger.getInstance().gameSceneRec.unlockControl();
						webNetworkMananger.getInstance().gameSceneRec.ControlMove(-10, 0);//通过程序控制摇杆，使玩家向右移动，撞向AI的舌网
						setTimeout(() => {
							webNetworkMananger.getInstance().gameSceneRec.unlockControl();
							webNetworkMananger.getInstance().gameSceneRec.ControlMove(10, 0);//通过程序控制摇杆，使玩家向右移动，撞向AI的舌网
						}, 500);
					}
					this.Clip_CallBack(type, 1000);
					return;
				}
				if (this.Clip_shuzu[type].name == "miwu") {
					this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 0.8;
					//this.ClipLayer.addChild(this.Clip_shuzu[type]);
					this.addChild(this.Clip_shuzu[type]);
					this.Clip_shuzu[type].x = -40;
					this.Clip_shuzu[type].y = -60;
					if (this.miwuTime == 0) {
						this.Clip_shuzu[type].play(1);
						this.miwuTime = 1;
					} else {
						this.Clip_shuzu[type].play(2);
					}
					this.Clip_CallBack(type, 1000);
					return;
				}
				if (this.Clip_shuzu[type].name == "xinsui") {
					this.addChild(this.Clip_shuzu[type]);
					//设定眩晕时副帧动画（第二个帧动画）的冒泡的位置从青蛙头顶开始
					this.Clip_shuzu[type].x = -30;
					this.Clip_shuzu[type].y = -100;
					this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 0.8;
					if (this.xinsuiTime == 0) {
						this.xinsuiTime = 1;
						this.Clip_shuzu[type].play(1);
					} else {
						this.Clip_shuzu[type].play(2);
					}
					this.Clip_CallBack(type, 1000);
					this.eye_change1();
					this.eye_change2();
					egret.Tween.get(this.Clip_shuzu[type])
						.to({ alpha: 1 }, 1000 + 10)
						.call(() => {
							this.Clip_shuzu[type].visible = false;
							this.nowPropsType[8] = -1;
						}, this);
					return;
				}
			}
		}
		/** 冰冻效果2：青蛙身上出现冰块*/
		protected ice_Play() {
			//this.ice2.texture = RES.getRes("ice_2_png");
			this.ice2.anchorOffsetX = this.ice2.width / 2;
			this.ice2.anchorOffsetY = this.ice2.height / 2;
			if (Math.floor(this.level / 10) == 1) {
				this.ice2.scaleX = this.ice2.scaleY = 0.8;
			} else if (Math.floor(this.level / 10) == 2) {
				this.ice2.scaleX = this.ice2.scaleY = 0.9;
			} else if (Math.floor(this.level / 10) == 3) {
				this.ice2.scaleX = this.ice2.scaleY = 1.1;
			} else {
				this.ice2.scaleX = this.ice2.scaleY = 1.2;
			}
			this.ice2.x = 0;
			this.ice2.y = -10;
			this.ice2.visible = true;
			//记录青蛙当前尺寸
			var w = this.width
			var h = this.height
			/**此处添加会导致青蛙长宽变化 因此记录青蛙长宽 更改回去 避免阴影出错 */
			this.addChild(this.ice2);
			this.ice2.alpha = 0;
			this.width = w
			this.height = h
			egret.Tween.get(this.ice2)
				.to({ alpha: 1 }, 1000)
				.to({ alpha: 1 }, serverConfig.config.propBuffReationTime.ice - 2000)
				.to({ alpha: 0 }, 1000)
			return;
		}
		/** 舔到异色青蛙眼睛两边变化*/
		protected eye_change1() {
			if (this.isInRange == true) {
				FaceManager.GetInstance().ChangeAwkardEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
				// var heixian: eui.Image = new eui.Image();
				// heixian.texture = RES.getRes("heixian_png");
				// this.heixian.anchorOffsetX = this.heixian.width / 2;
				// this.heixian.anchorOffsetY = this.heixian.height / 2;
				// var han: eui.Image = new eui.Image();
				// han.texture = RES.getRes("han_png");
				// this.han.anchorOffsetX = this.han.width / 2;
				// this.han.anchorOffsetY = this.han.height / 2;
				this.han.visible = true;
				this.heixian.visible = true;
			}
			if (Math.floor(this.level / 10) == 1) {
				this.heixian.x = 20;
				this.heixian.y = -45;
				this.han.x = -30;
				this.han.y = -40;
				this.heixian.scaleX = this.heixian.scaleY = 0.7;
				this.han.scaleX = this.han.scaleY = 0.2;
			} else if (Math.floor(this.level / 10) == 2) {
				this.heixian.x = 22;
				this.heixian.y = -45;
				this.han.x = -22;
				this.han.y = -40;
				this.heixian.scaleX = this.heixian.scaleY = 0.75;
				this.han.scaleX = this.han.scaleY = 0.25;
			} else if (Math.floor(this.level / 10) == 3) {
				this.heixian.x = 30;
				this.heixian.y = -45;
				this.han.x = -30;
				this.han.y = -40;
				this.heixian.scaleX = this.heixian.scaleY = 0.8;
				this.han.scaleX = this.han.scaleY = 0.3;
			} else {
				this.heixian.x = 40;
				this.heixian.y = -45;
				this.han.x = -30;
				this.han.y = -40;
				this.heixian.scaleX = this.heixian.scaleY = 0.85;
				this.han.scaleX = this.han.scaleY = 0.35;
			}
			this.han.x = -30;
			this.han.y = -40;
			this.addChild(this.heixian);
			this.addChild(this.han);
			this.han.alpha = 0;
			egret.Tween.get(this.heixian)
				.to({ alpha: 1 }, 50)
				.to({ y: this.heixian.y + 10 }, 950)
			egret.Tween.get(this.han)
				.to({ alpha: 1 }, 50)
				.to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
				.to({ scaleX: this.han.scaleX - 0.8, scaleY: this.han.scaleY - 0.8 }, 100)
				.to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
				.to({ scaleX: this.han.scaleX - 0.8, scaleY: this.han.scaleY - 0.8 }, 100)
				.to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
				.to({ scaleX: this.han.scaleX - 0.8, scaleY: this.han.scaleY - 0.8 }, 100)
				.to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
				.to({ scaleX: this.han.scaleX - 0.8, scaleY: this.han.scaleY - 0.8 }, 100)
				.to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
				.to({ alpha: 0 }, 60)
				.call(() => {
					this.han.visible = false;
					this.heixian.visible = false;
					FaceManager.GetInstance().ChangeNormalEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
					egret.Tween.removeTweens(this.han);
				}, this);
			return;
		}
		/** 舔到异色青蛙眼睛内变化*/
		protected eye_change2() {
			if (Math.floor(this.level / 10) == 1) {
				this.eyeLeft.scaleX = this.eyeLeft.scaleY = 0.33;
				this.eyeRight.scaleX = this.eyeRight.scaleY = 0.33;
				this.eyeLeft.x = -14;
				this.eyeRight.x = 13;
			} else if (Math.floor(this.level / 10) == 2) {
				this.eyeLeft.scaleX = this.eyeLeft.scaleY = 0.35;
				this.eyeRight.scaleX = this.eyeRight.scaleY = 0.35;
				this.eyeLeft.x = -10;
				this.eyeRight.x = 17;
			} else if (Math.floor(this.level / 10) == 3) {
				this.eyeLeft.scaleX = this.eyeLeft.scaleY = 0.38;
				this.eyeRight.scaleX = this.eyeRight.scaleY = 0.38;
				this.eyeLeft.x = -14;
				this.eyeRight.x = 19;
			} else {
				this.eyeLeft.scaleX = this.eyeLeft.scaleY = 0.4;
				this.eyeRight.scaleX = this.eyeRight.scaleY = 0.4;
				this.eyeLeft.x = -14;
				this.eyeRight.x = 19;
			}
			this.eyeLeft.y = -33;
			this.eyeRight.y = -33;
			this.eyeLeft.visible = true;
			this.eyeRight.visible = true;
			this.addChild(this.eyeLeft);
			this.addChild(this.eyeRight);
			this.eye_Tween(this.eyeLeft);
			this.eye_Tween(this.eyeRight);
		}
		/**眼珠tween动画 */
		protected eye_Tween(eye) {
			egret.Tween.get(eye)
				.to({ scaleX: 0, scaleY: 0 }, 300)
				.call(() => {
					eye.texture = this.eyeLR.texture;
					eye.anchorOffsetX = eye.width / 2;
					eye.anchorOffsetY = eye.height / 2;
					eye.scaleX = 0.2;
					eye.scaleY = 1;
					egret.Tween.get(eye)
						.to({ scaleX: 1 }, 200)
						.to({ scaleX: 0.2 }, 200)
						.to({ alpha: 1 }, 310)
						.call(() => {
							eye.visible = false;
							egret.Tween.removeTweens(eye);
						}, this);
					egret.Tween.removeTweens(eye);
				}, this);
		}
		/**帧动画回调的隐藏动画方法 */
		protected Clip_CallBack(type: number, time: number) {
			egret.Tween.get(this.Clip_shuzu[type])
				.to({ alpha: 1 }, time + 10)
				.call(() => {
					this.Clip_shuzu[type].visible = false;
					this.nowPropsType[type + 1] = -1;
					egret.setTimeout(() => { this.ClipLayer.removeChildren() }, this, 500)//删除帧动画层所有子物体					
					if (type == 8 && DataProl.isXinShou) {
						webNetworkMananger.getInstance().gameSceneRec.displayer_message(9, 900, 500);
					}
					egret.Tween.removeTweens(this.Clip_shuzu[type]);
				}, this);
		}
		private nameTimer: egret.Timer = new egret.Timer(10, -1);
		public setClip(type: number, x: any, y: any, num: number) {
			this.Clip_shuzu[type].play(num);//帧动画播放次数
			///**固定动画播放位置在名字正上方，且方向固定 */
			this.nameTimer.addEventListener(egret.TimerEvent.TIMER, e => {
				this.Clip_shuzu[type].x = this.x + x;
				this.Clip_shuzu[type].y = this.y + y;
			}, this);
			this.nameTimer.start();
		}
		/**显示道具效果 */
		protected displayEffectOfProps(propstates) {
			if (this.isInRange == true) {
				for (var i = 0; i < propstates.length; i++) {
					var type = propstates[i].getPropType;
					if (type <= 0) {
						this.nowPropsType[type - 1] = type
						continue;
					}
					if (this.nowPropsType[type - 1] == type) {
						continue;
					}
					if (type == 1) {
						this.effectOfProps = this.zhuangtai_1;
						this.effectOfProps.anchorOffsetX = this.effectOfProps.width / 2;
						this.effectOfProps.anchorOffsetY = this.effectOfProps.height / 2;
						this.effectOfProps.scaleX = this.effectOfProps.scaleY = 0.5;
						this.effectOfProps.visible = true;
						this.alpha = 0.1;
						this.nowPropsType[type - 1] = type;
						//console.log("111111111              " + this.nowPropsType);
						continue;
					}
					if (type == 6 || type == 7) {
						continue;
					}
					if (type == 8) {
						this.nowPropsType[type - 1] = type
						this.MovieClipPlay(type - 2);//帧动画播放方法
						this.bowen();
					}
					if (type == 9) {
						this.nowPropsType[type - 1] = type
						this.MovieClipPlay(type - 1);//帧动画播放方法
					}
					if (type == 3 || type == 2 || type == 5) {
						this.MovieClipPlay(type - 2);//帧动画播放方法
						if (type == 5) {//吃到变色道具
							this.MovieClipPlay(7);//播放变色迷雾
						}
						this.nowPropsType[type - 1] = type

					}
					if (type == 4) {
						this.MovieClipPlay(type - 2);//帧动画播放方法
						this.MovieClipPlay(5);
						this.nowPropsType[type - 1] = type

					}
				}
			}
		}

		/**震颤次数 */
		protected zhenchanTimeRight = 0;
		protected zhenchanTimeLeft = 0;
		/**添加碰撞是左右两侧的波纹(bowen) */
		protected bowen() {

			this.bwRight.x = 50;
			this.bwRight.y = 0;
			this.bwRight.visible = true;
			this.addChild(this.bwRight);

			this.bwLeft.skewY = 180;
			this.bwLeft.x = -50;
			this.bwLeft.y = 0;
			this.bwLeft.visible = true;
			this.addChild(this.bwLeft);
			this.zhenchan(this.bwRight, this.zhenchanTimeRight, 60, 50)
			this.zhenchan(this.bwLeft, this.zhenchanTimeLeft, -60, -50)
		}

		protected zhenchan(picture, time, x1: number, x2: number) {
			egret.Tween.get(picture)
				.to({ x: x1 }, 50)
				.to({ x: x2 }, 50)
				.to({ x: x1 }, 50)
				.to({ x: x2 }, 50)
				.to({ alpha: 1 }, 5)
				.call(e => {
					// if (time < serverConfig.config.propBuffReationTime.dizzy / 100 - 1) {
					// 	time += 1;
					// 	this.zhenchan(picture, time, x1, x2)
					// } else {
					time = 0;
					picture.visible = false;
					// }
					egret.Tween.removeTweens(picture);
				});
		}
		/**舌头位置临时变量 */
		private tonguePointLoacalTem: egret.Point = new egret.Point();
		/**我的位置临时变量 */
		private myPointLoaclTem: egret.Point = new egret.Point();
		/**伸舌 */
		public loll() {
			if (!this.tweenOver) {
				return;
			}
			egret.Tween.removeTweens(this);
			let tonguePoint: egret.Point = this.localToGlobal(this.tongue.x, this.tongue.y, this.tonguePointLoacalTem);
			let myPoint: egret.Point = this.parent.localToGlobal(this.x, this.y, this.myPointLoaclTem);
			let direction = tonguePoint.subtract(myPoint);
			//给服务器发送射击信息
			AIServer.getInstance().shoot(this.userid, direction);
		}
		/**伸舌动画 */
		public lollAnime(longTongue: number) {
			let length = longTongue == 0 ? this.frogLineLength : longTongue;
			let tongue: eui.Image = this.tongue;
			tongue.height = this.scaleX * this.tongueWide;
			tongue.y = this.scaleX * (0 - 40);
			tongue.visible = true;
			tongue.width = 0;
			egret.Tween.get(tongue).to({ width: length * frogConfig.independent_Long_tongue_coefficient }, 100)
				.to({ width: 0 }, 100)
				.call(e => {
					tongue.visible = false
					egret.Tween.removeTweens(tongue);
				});
		}
		/**获取朝向坐标 */
		public getTowardCoordinates() {
			let front = this.localToGlobal(0, 50);
			let myPoint = this.parent.localToGlobal(this.x, this.y);
			let direction = front.subtract(myPoint);
			return direction;
		}
		/**反向弹出 */
		public ReversePop_up(point: egret.Point, isaccount = false) {
			let myOrientation: egret.Point = this.getTowardCoordinates();
			if (myOrientation != null && myOrientation != undefined) {
				myOrientation.setTo(myOrientation.x, myOrientation.y);
				myOrientation.normalize(100);
				let targePoint = myOrientation.add(new egret.Point(this.x, this.y));
				// egret.Tween.get(this).to({ x: targePoint.x, y: targePoint.y }, 200).call(e => {
				// 	//this.canMove = true 
				// });

				TweenLite.to(this, 0.5, { x: targePoint.x, y: targePoint.y, ease: Back.easeInOut });
			}
		}

		/**饰品设置 */
		protected shipinInit() {
			this.shipin.texture = resManager.getInstance().getExpressionGroups(7);
			this.shipin.anchorOffsetX = this.shipin.width / 2;
			this.shipin.anchorOffsetY = this.shipin.height / 2;
			this.shipin.x = 0;
			this.shipin.y = -35;
			this.shipin.scaleX = 0.7;
			this.shipin.scaleY = 0.85;
			this.addChild(this.shipin);
			this.shipin.visible = false;
			//this.changeShipin("shipin_" + (Math.floor(Math.random()*5+1)));
		}
		/**击杀表情 */
		protected jisha() {
			this.shipin1.texture = resManager.getInstance().getExpressionGroups(17);
			this.shipin1.anchorOffsetX = this.shipin1.width / 2;
			this.shipin1.anchorOffsetY = this.shipin1.height / 2;
			this.shipin1.x = 0;
			this.shipin1.y = -35;
			this.shipin1.scaleX = 0.7;
			this.shipin1.scaleY = 0.85;
			this.addChild(this.shipin1);
			this.shipin1.visible = false;
			//this.changeShipin("shipin_" + (Math.floor(Math.random()*5+1)));
		}
		/**改变饰品 */
		protected changeShipin(shipintype) {
			switch (shipintype) {
				case "shipin_1":
					this.shipin.texture = this.shipin_1.texture;
					break;
				case "shipin_2":
					this.shipin.texture = this.shipin_2.texture;
					break;
				case "shipin_3":
					this.shipin.texture = this.shipin_3.texture;
					break;
				case "shipin_4":
					this.shipin.texture = this.shipin_4.texture;
					break;
				case "shipin_5":
					this.shipin.texture = this.shipin_5.texture;
					break;
			}
			//this.shipin.texture = RES.getRes(shipintype);
			if (this.userid == DataProl.account) {
				this.shipin.visible = true;
			}
			else {
				this.shipin.visible = false;
			}
		}
		/**显示护盾 */
		protected displayShield() {
			this.shieldOuter.texture = resManager.getInstance().getExpressionGroups(15);
			this.shieldInside.texture = resManager.getInstance().getExpressionGroups(16);
			this.shieldOuter.anchorOffsetX = this.shieldOuter.width / 2;
			this.shieldOuter.anchorOffsetY = this.shieldOuter.height / 2;

			this.shieldInside.anchorOffsetX = this.shieldInside.width / 2;
			this.shieldInside.anchorOffsetY = this.shieldInside.height / 2;

			this.shieldOuter.x = this.shieldInside.x = 0;
			this.shieldOuter.y = this.shieldInside.y = -25;
			this.addChild(this.shieldOuter);
			this.addChild(this.shieldInside);
			this.displayOrHideShield(false);
			//this.tu.texture = RES.getRes("eye_1");
			this.tu.anchorOffsetX = this.tu.width / 2;
			this.tu.anchorOffsetY = this.tu.height / 2;
			this.tu.x = 0;
			this.tu.y = -35;
			this.addChild(this.tu);
			this.tu.visible = false;
		}
		/**显示或隐藏保护罩 */
		protected displayOrHideShield(disOrHide: boolean) {
			this.shieldOuter.visible = this.shieldInside.visible = disOrHide;
			if (disOrHide) {
				egret.Tween.get(this.shieldInside).to({ rotation: (this.shieldInside.rotation + 4) }, 1000 / 60);
				this.killNum = 0;
			}
			else {
				egret.Tween.removeTweens(this.shieldInside);
			}

		}
		/**青蛙转向 */
		public frogVeer() {
			var angle = this.getFrogAngle(this.x, this.y, this.targetPoint.x, this.targetPoint.y);
			if (!isNaN(angle)) {
				var addtime = 0;
				if (angle > 160) {
					addtime += angle / 90;
				}
				egret.Tween.get(this).to({ rotation: angle }, gameGlobal.global.frogRotateTime - addtime);
			}
		}
		/**重置影子青蛙的位置 */
		public OnresetShadowFogPoint(obj) {

			let shadowFrog = obj.m_frogMgr.findFrogById(DataProl.shadowFrogId);
			if (shadowFrog != null) {
				shadowFrog.x = obj.x;
				shadowFrog.y = obj.y;
				console.log("同步更改影子青蛙" + DataProl.shadowFrogId);
			}

		}
		/**青蛙原地复活 */
		public FrogPointNew(obj) {
			let LastFrogPoint = obj.m_frogMgr.findFrogById(DataProl.account);
			if (LastFrogPoint != null) {
				// Allvariate.getInstance().FrogPoint.x = LastFrogPoint.x;
				// Allvariate.getInstance().FrogPoint.y = LastFrogPoint.y;
				LastFrogPoint.x = obj.x;
				LastFrogPoint.y = obj.y;
			}
			console.log(LastFrogPoint.x + "wweqeqeqeqwew");
			console.log(LastFrogPoint.y + "wweqeqeqeqwew");
		}
		/**青蛙动画初始化 */
		protected frogAnimationInit() {
			if (this.frogAniamtionDis != null) {
				this.removeChild(this.frogAniamtionDis);
				this.frogAniamtionDis.armature.dispose();
				this.frogAniamtionDis = null;
			}
		}
		/**处理青蛙升级
		 * @param playerData 玩家数据
		 */
		public dealFrogUpgrade(playerData) {
			if (this.level == playerData.level) {
				return;
			}
			//升级播放升级特效
			if (this.level < playerData.level) {
				this.Clip_shuzu[9].visible = false;
				this.MovieClipPlay(9);
				//this.playUserUpgrade(this._texture, this._config, 0, 0);
			}
			//如果主要等级不同换龙骨
			if (Math.floor(this.level / 10) != Math.floor(playerData.level / 10)) {
				this.level = playerData.level;
				/**主要等级 */
				let mainLevel = Math.floor(this.level / 10);
				this.frogAnimationInit();
				this.frogAniamtionDis = meterAanimation.getInstance().GetDragonAnimation(mainLevel);
				this.addChild(this.frogAniamtionDis);
				this.setChildIndex(this.frogAniamtionDis, 0);
				//升级体积变化
				switch (mainLevel) {
					case 1:
						this.scaleX = this.scaleY = 1;
						break;
					case 2:
						this.scaleX = this.scaleY = 1.3;
						break;
					case 3:
						this.scaleX = this.scaleY = 1.7;
						break;
					case 4:
						this.scaleX = this.scaleY = 2.2;
						break;
					default:
						break;
				}
			}
			this.level = playerData.level;
			FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
		}
		/**连线青蛙后置 */
		public setFrogPos() {
			this.frogAniamtionDis.y = this.frogIsHadLine ? 0 : 0;
			this.shieldOuter.y = this.shieldInside.y = this.frogAniamtionDis.y - 25;
		}
		/**设置下个目标点 */
		public setTargetPoint(point) {
			if (this.userid == DataProl.shadowFrogId) {
				this.targetPoint.x = this.x + point.x;
				this.targetPoint.y = this.y + point.y;
				return;
			}
			this.targetPoint.x = point.x;
			this.targetPoint.y = point.y;
			if (this.tweenOver) {
				this.frogMoveto();
			}
			this.SetFrogNamePoint();


		}
		/**换装 */
		public changeType() {
			//this.changeClothes.changeClothes(this.frogAniamtionDis, this.type, this.mainLevel, this.minLevel);
			FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);

		}
		protected time: number;
		/*判断*/
		public shadowFrogMoveto(target) {
			egret.Tween.removeTweens(this);
			this.curPoint.x = this.x;
			this.curPoint.y = this.y;
			// if (!this.frogIsHadLine) {
			// 	if (this.x == this.targetPoint.x && this.y == this.targetPoint.y) {
			// 		//console.log("玩家没有移动");
			// 		return;
			// 	}
			// }
			/**影子青蛙移动 */
			this.targetPoint.x = this.x + target.x;
			this.targetPoint.y = this.y + target.y;


			if (this.targetPoint.x > gameGlobal.global.gameWidth - 55) {
				console.log("bianjie1");
				this.targetPoint.x = gameGlobal.global.gameWidth - 55;
			}
			if (this.targetPoint.y > gameGlobal.global.gameHeight - 65) {
				this.targetPoint.y = gameGlobal.global.gameHeight - 65;
				console.log("bianjie2");
			}
			if (this.targetPoint.x < 50) {
				this.targetPoint.x = 50;
				console.log("bianjie3");
			}
			if (this.targetPoint.y < 60) {
				this.targetPoint.y = 60;
				console.log("bianjie4");
			}

			return;
		}
		private timeOnEnterFrame = 0;
		/**青蛙移动 */
		public frogMoveto() {
			var now = egret.getTimer();
			var time = this.timeOnEnterFrame;
			var pass = now - time;
			this.timeOnEnterFrame = egret.getTimer();
			egret.Tween.removeTweens(this);
			var angle = this.getFrogAngle(this.x, this.y, this.targetPoint.x, this.targetPoint.y);
			if (!this.frogIsHadLine) {
				if (this.x == this.targetPoint.x && this.y == this.targetPoint.y) {
					//console.log("玩家没有移动");
					return;
				}
			}
			/**影子青蛙移动 */
			if (this.userid == DataProl.shadowFrogId) {
				this.x = this.targetPoint.x;
				this.y = this.targetPoint.y;
				return;
			}
			//egret.Tween.get(this).to({ x: this.targetPoint.x, y: this.targetPoint.y }, pass);
			TweenLite.to(this, 1 / 3600, { x: this.targetPoint.x, y: this.targetPoint.y });
			if (!isNaN(angle)) {
				var addtime = 0;
				if (angle > 160) {
					addtime += angle / 90;
				}

				//egret.Tween.get(this).to({ rotation: angle }, gameGlobal.global.frogRotateTime - addtime);
				TweenLite.to(this, 1 / 3600, { rotation: angle });
				return;
			}
		}

		/**获取玩家需要旋转的角度 */
		protected getFrogAngle(mx, my, targetx, targety): number {
			var angle;
			var ligUserId = null;
			var point = null;
			if (this.frogIsHadLine) {
				ligUserId = this.getLineUserId();

				if (ligUserId != null)
					point = this.getLineUserPoint(ligUserId);
				else
					angle = Util.getInstance().getRotation({ x: mx, y: my }, { x: targetx, y: targety });

				if (point != null)
					angle = Util.getInstance().getRotation({ x: mx, y: my }, { x: point.x, y: point.y });
				else
					angle = Util.getInstance().getRotation({ x: mx, y: my }, { x: targetx, y: targety });
			}
			else {
				this.changeFaceEye(1, null);//00修改				
				angle = Util.getInstance().getRotation({ x: this.x, y: this.y }, { x: targetx, y: targety });
			}

			return angle;
		}

		/** 获取连线玩家Id */
		protected getLineUserId() {
			return this.m_frogMgr.getLigatureUserId(this.userid);
		}
		/**获取连线玩家坐标 */
		protected getLineUserPoint(ligaUserId): any {
			var frog = this.m_frogMgr.findFrogById(ligaUserId);
			if (frog == null) {
				return null;
			}
			return { x: frog.x, y: frog.y };
		}
		/**青蛙重置 */

		public reset() {
			this.visible = this.isUsed = false;
			this.deathDate = null;
			if (this.userid == DataProl.account) {
				this.y = Allvariate.getInstance().FrogPoint.y;
				this.x = Allvariate.getInstance().FrogPoint.x;
			} else {
				this.y = 0;
				this.x = 0;
			}
			this.userid = -1;
			if (this.frogTrai)
				this.frogTrai.visible = false;
			this.targetPoint.x = this.targetPoint.y = 0;
			this.scaleX = this.scaleY = 1;
			this.tweenOver = true;
			this.displayOrHideShield(false);
			this.frogName.text = "";
			this.frogName.visible = false;
			this.ClipLayer.removeChildren();//清除所有在ClipLayer层上的动画
			this.nowPropsType = [-1, -1, -1, -1, -1, -1, -1, -1, -1];
		}
		/**青蛙重置(新手引导) */
		public reset2() {
			//this.scaleX = this.scaleY = 1;
			this.tweenOver = true;
			this.displayOrHideShield(false);

			this.nowPropsType = [-1, -1, -1, -1, -1, -1, -1, -1, -1];
			for (var i: number = 0; i < 9; i++) {
				this.ClipLayer.addChild(this.Clip_shuzu[i]);
			}
			this.ClipLayer.removeChildren();//清除所有在ClipLayer层上的动画F
		}

		//快要断线了
		/**改变青蛙眼睛表情 ,faceTppe=0为快断线的眼，=1是正常眼*/
		public changeFaceEye(faceTppe: number, linemax: number) {//00修改快断线+舌头的最长距离a==0
			if (this.isInRange == true) {
				if (this.qineyer != faceTppe && this.qineyer != 4 && this.qineyer != 3) {
					this.qineyer = faceTppe;
					if (faceTppe == 0) {
						if (this.eyetime == -1) {
							FaceManager.GetInstance().ChangeWinkEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
							//faceTppe = 0;							
						}
					}
					else if (faceTppe == 1) {
						if (this.eyetime == -1) {
							FaceManager.GetInstance().ChangeNormalEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
						}
					}
					else {
						this.eyetime = Date.now();
						FaceManager.GetInstance().ChangeHeartEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
						faceTppe = 4;
						if (faceTppe == 4) {//眼睛变红心帧动画
							this.MovieClipPlay(4);
						}
					}
				}
			}
		}
		public born(userid, name, x, y, frogType, levle, dressup) {
			// if (this.deathDate != null) {
			// 	this.visible = false;
			// 	return;
			// }
			if (userid == DataProl.shadowFrogId) {
				this.alpha = 0.5;
			}
			this.frogAnimationInit();
			this.frogAniamtionDis = meterAanimation.getInstance().GetDragonAnimation(1);
			this.addChild(this.frogAniamtionDis);
			this.x = x;
			this.y = y;
			this.userid = userid;
			this.username = name;
			this.type = 1;
			this.level = 11;
			this.ClipLayer.removeChildren();//清除所有在ClipLayer层上的动画
			this.nowPropsType = [-1, -1, -1, -1, -1, -1, -1, -1, -1];
			/**初始化时换装  防止颜色出错*/
			FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
			this.setChildIndex(this.frogAniamtionDis, 0);
			if (this.userid != DataProl.account && DataProl.isXinShou) {
				this.frogAniamtionDis = meterAanimation.getInstance().GetDragonAnimation(1);
				this.addChild(this.frogAniamtionDis);
				FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
				this.setChildIndex(this.frogAniamtionDis, -1);
			}

			// if (dressup != null) {
			// 	if (dressup.decorateId > 0) {
			// 		this.changeShipin("shipin_" + (dressup.decorateId - 1000));
			// 	}
			// 	if (dressup.trailingId > 0) {
			// 		this.frogTrailing(dressup.trailingId - 2000);
			// 	}

			// }

			// console.log("zhaungban   " + dressup.decorateId);
			// this.changeShipin("shipin_"+3);
			// this.frogTrailing(2);
			//this.setFrogName(this.userid.toString());
			this.setFrogName(this.username.toString());
			this.isInRange = true;
			this.visible = this.isUsed = true;
			if (this.frogTrai)
				this.frogTrai.visible = true;
			if (userid == DataProl.account && webNetworkMananger.getInstance().gameSceneRec) {
				webNetworkMananger.getInstance().gameSceneRec.myUser.userSprit = this;
				if (!DataProl.isXinShou) {
					webNetworkMananger.getInstance().gameSceneRec.camera.setTarget(this);
				}

			}
			if (this.userid == DataProl.account) {//判断是不是自己
				this.OnresetShadowFogPoint(this);
			}
			if (dressup != null) {
				if (dressup.decorateId > 0) {
					this.changeShipin("shipin_" + (dressup.decorateId - 1000));
				}
				if (dressup.trailingId > 0) {
					this.frogTrailing(dressup.trailingId - 2000);
				}

			}

		}

		/**设置青蛙的名字 */
		public setFrogName(nameStr) {
			if (nameStr == null || this.frogName == null)
				return;
			this.frogName.visible = true;
			var DisLen = gameGlobal.global.frogShowNameLength;
			var name = nameStr.length > DisLen ? nameStr.substring(0, DisLen) : nameStr;
			this.frogName.text = name;
			this.frogName.width = 220;
			if (this.userid == DataProl.account)
				this.frogName.textColor = 0xe3fe03;
		}

		public getdistance(x, y) {
			return Math.sqrt(x * x + y * y);
		}

		/**初始化名字 */
		protected displayFrogName() {
			this.frogName = new eui.Label();
			this.frogName.fontFamily = "Microsoft YaHei";
			this.frogName.width = 60;
			this.frogName.height = 40;
			this.frogName.anchorOffsetX = this.frogName.width / 2;
			this.frogName.anchorOffsetY = this.frogName.height / 2;

			this.effectOfProps.anchorOffsetX = this.effectOfProps.width / 2;
			this.effectOfProps.anchorOffsetY = this.effectOfProps.height / 2;
			this.effectOfProps.scaleX = this.effectOfProps.scaleY = 3;
			this.frogName.textAlign = egret.HorizontalAlign.CENTER;
			this.frogName.verticalAlign = egret.VerticalAlign.MIDDLE;

			this.gamePanleHandle.addChild(this.frogName);
			this.gamePanleHandle.addChild(this.effectOfProps);

			this.frogName.visible = false;
		}
		/**设置青蛙名字位置 */
		public SetFrogNamePoint() {
			this.frogName.x = this.x - 70;
			this.frogName.y = this.y - 90;
			this.effectOfProps.x = this.x + 10;
			this.effectOfProps.y = this.y - 120;
		}
		/**获取青蛙位置 */
		// public LastFrogPoint: control.frog;
		// public static OnresetFrogPoint(obj) {
		// 	this.LastFrogPoint.x = webNetworkMananger.getInstance().gameSceneRec.m_createAllFrogs.findFrogById(DataProl.account).x;
		// 	this.LastFrogPoint.y = webNetworkMananger.getInstance().gameSceneRec.m_createAllFrogs.findFrogById(DataProl.account).y;
		// 	console.log(this.LastFrogPoint.x + "青蛙");

		// }
		/**播放玩家死亡动画 */
		public frogDied() {
			if (this.isUsed == false)
				return;
			//重置青蛙状态
			AIServer.getInstance().resetUserStates(this.userid)
			FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);

			if (this.userid == DataProl.account) {
				webNetworkMananger.getInstance().gameSceneRec.userDied.disPlayerDiedPanl();
				// let LastFrogPoin = webNetworkMananger.getInstance().gameSceneRec.m_createAllFrogs.findFrogById(DataProl.account);
				// Allvariate.getInstance().FrogPoint.x = LastFrogPoin.x;
				// Allvariate.getInstance().FrogPoint.y = LastFrogPoin.y;
				// console.log(LastFrogPoin.x + "lingyige");
				// console.log(LastFrogPoin.y + "lingyige");
			}
			// if (this.Clip2 != null) {
			// 	this.Clip2.visible = false;
			// }
			// if (this.Clip3 != null) {
			// 	this.Clip3.visible = false;
			// }
			this.reset();
			//this.reset();
		}

		//升级
		protected _texture: egret.Texture;
		protected _config: any;

		// protected _texture1: egret.Texture;
		// protected _config1: any;

		// protected _texture2: egret.Texture;
		// protected _config2: any;

		/**
		 * 播放玩家升级特效
		 */
		protected playUserUpgrade(_texture: egret.Texture, _config: any, x: number, y: number): void {
			if (!serverConfig.config.isParticleRun)
				return;
			// if (this._texture && this._config) {
			// 	var lizi = new particle.GravityParticleSystem(this._texture, this._config);
			// 	this.addChild(lizi);
			// 	lizi.start(1);
			// 	lizi.anchorOffsetX = lizi.width / 2;
			// 	lizi.anchorOffsetY = lizi.height / 2;
			// 	lizi.x = this.frogAniamtionDis.x;
			// 	lizi.y = this.frogAniamtionDis.y;
			// }
			if (_texture && _config) {
				var lizi = new particle.GravityParticleSystem(_texture, _config);
				this.addChild(lizi);
				//this.tralingLayer.addChild(lizi);
				lizi.start(2);
				lizi.anchorOffsetX = lizi.width / 2;
				lizi.anchorOffsetY = lizi.height / 2;
				lizi.x = this.frogAniamtionDis.x + x;
				lizi.y = this.frogAniamtionDis.y + y;
				// var nameTimer: egret.Timer = new egret.Timer(10, -1);
				// nameTimer.addEventListener(egret.TimerEvent.TIMER, e => {
				// 	lizi.x = this.x ;
				// 	lizi.y = this.y ;
				// }, this);
				// nameTimer.start();
				// var liziTimer: egret.Timer = new egret.Timer(100, -1);
				// liziTimer.addEventListener(egret.TimerEvent.TIMER, e => {
				// 	lizi.emitterX = this.x;
				// 	lizi.emitterY = this.y;
				// }, this);
				// liziTimer.start();
			}
		}
		// protected playUserUpgrade2(): void {
		// 	if (!serverConfig.config.isParticleRun)
		// 		return;
		// 	if (this._texture2 && this._config2) {
		// 		var lizi2 = new particle.GravityParticleSystem(this._texture, this._config);
		// 		this.addChild(lizi2);
		// 		lizi2.start(1);
		// 		lizi2.anchorOffsetX = lizi2.width / 2;
		// 		lizi2.anchorOffsetY = lizi2.height / 2;
		// 		lizi2.x = this.frogAniamtionDis.x;
		// 		lizi2.y = this.frogAniamtionDis.y;
		// 	}

		// }

		/**加载升级资源 */
		public loadRes(): void {
			this._texture = RES.getRes("LevelUp_png");
			this._config = RES.getRes("LevelUp_json");
			// this._texture1 = RES.getRes("LevelUp1_png");
			// this._config1 = RES.getRes("LevelUp1_json");
			// this._texture2 = RES.getRes("LevelUp2_png");
			// this._config2 = RES.getRes("LevelUp2_json");
		}

        /**
		 * 青蛙拖尾
		 */
		protected frogTrailing(type) {
			if (!serverConfig.config.isParticleRun)
				return;
			var tuowei_Texture = RES.getRes("tuowei_" + type.toString());
			var tuowei_Config = RES.getRes("newTuowei_json");
			if (tuowei_Texture && tuowei_Config) {
				this.frogTrai = new particle.GravityParticleSystem(tuowei_Texture, tuowei_Config);
				this.tralingLayer.addChild(this.frogTrai);
				this.frogTrai.start();
				var liziTimer: egret.Timer = new egret.Timer(100, -1);
				liziTimer.addEventListener(egret.TimerEvent.TIMER, e => {
					this.frogTrai.emitterX = this.x;
					this.frogTrai.emitterY = this.y;
				}, this);
				liziTimer.start();
			}
			if (!this.isUsed && this.frogTrai) {
				this.frogTrai.visible = false;
			}
		}

		public static moveDirection(dir: egret.Point): number {//返回方向  
			//计算角度、方向   Math.atan2根据两点坐标计算到的弧度  
			var angleSpeed: number = Math.atan2(dir.y, dir.x);
			//弧度转化为角度 角度= 弧度*180/π  
			var N = angleSpeed * 180 / Math.PI;
			return N;
		}
		/**AI弹开tween动画 */
		public flicktweenAI(point) {
			this.tweenOver = false;
			var sX = this.scaleX;
			var sY = this.scaleY;
			egret.Tween.get(this).to({ x: point.x, y: point.y }, 400).call(this.flickcallback, this)

		}

		/**弹开tween动画 */
		public flicktween(point) {
			this.tweenOver = false;
			AIServer.getInstance().setUserStates(this.userid, 2)
			this.rolelock();
			var sX = this.scaleX;
			var sY = this.scaleY;
			egret.Tween.get(this).to({ x: point.x, y: point.y }, 400).call(this.flickcallback, this)
		}
		public flickcallback(e: egret.TouchEvent) {
			//删除所有tween动画
			egret.Tween.removeTweens(this);
			//解锁摇杆
			this.unrolelock()
			this.tweenOver = true;
			AIServer.getInstance().resetUserStates(this.userid);
		}
		/**获取贝塞尔曲线终点*/
		public setPoint(pointoverX, pointoverY) {
			this.pointOver.x = pointoverX;
			this.pointOver.y = pointoverY;
		}
		/**获取贝塞尔曲线控制点 */
		public get factor(): number {
			return 0;
		}
		/**定位贝塞尔曲线控制点 */
		public set factor(value: number) {
			this.x = (1 - value) * (1 - value) * this.x + 2 * value * (1 - value) * (this.x + this.pointOver.x) / 2 + value * value * (this.pointOver.x);
			this.y = (1 - value) * (1 - value) * this.y + 2 * value * (1 - value) * (this.y + this.pointOver.y) / 2 + value * value * (this.pointOver.y);
		}
		/**青蛙舔到道具移动 */
		public lickProp(pointoverX: any, pointoverY: any) {
			//初始化阴影
			this.shadowinint();
			//设置阴影大小
			this.setShadow();
			//添加阴影到舞台
			this.addChildAt(this.shadow, 0);
			this.tweenOver = false;
			//曲线移动设置终点
			this.setPoint(pointoverX, pointoverY)
			var sX = this.scaleX;
			var sY = this.scaleY;
			var shadowX = this.shadow.scaleX;
			var shadowY = this.shadow.scaleY;
			egret.Tween.get(this.shadow).to({ scaleX: this.shadow.scaleX - 0.5, scaleY: this.shadow.scaleY - 0.5 }, 250).to({ scaleX: shadowX, scaleY: shadowY }, 250)
			egret.Tween.get(this).to({ scaleX: this.scaleX + 0.5, scaleY: this.scaleY + 0.5 }, 300).to({ scaleX: sX, scaleY: sY }, 300).call(this.callback, this);
			egret.Tween.get(this).to({ factor: 1 }, 2000)
			//锁定摇杆
			this.rolelock();
		}
		public callback(e: egret.TouchEvent) {
			//移动完毕后给假服务器发送当前位置
			var point = egret.Point.create(this.x, this.y)
			var data =
				{
					"target": point,
					"account": DataProl.account
				}
			AIServer.getInstance().ClientFly(data);
			//删除所有tween动画
			egret.Tween.removeTweens(this);
			//解锁摇杆
			this.unrolelock()
			this.tweenOver = true;
			/**删除阴影 */
			this.removeChild(this.shadow);
			//console.log(this.height,this.width)
			//console.log(this.anchorOffsetX,this.anchorOffsetY)
		}

		/**锁定摇杆 */
		private rolelock() {
			//获取当前游戏场景
			if (this.m_frogMgr.gameHandle != null && this.m_frogMgr.gameHandle != undefined) {
				var gamesence = this.m_frogMgr.gameHandle
				//获取摇杆
				if (gamesence.yaogan != null) {
					this.m_frogMgr.gameHandle.yaogan.lockControl();
				}
			}
		}
		/**解锁摇杆 */
		private unrolelock() {
			if (this.m_frogMgr.gameHandle != null && this.m_frogMgr.gameHandle != undefined) {
				var gamesence = this.m_frogMgr.gameHandle
				if (gamesence.yaogan != null) {
					this.m_frogMgr.gameHandle.yaogan.unlockControl();
				}
			}
		}



	}
}